//
//  IllustrationController.m
//  Hai
//
//  Created by wangzijian on 16/6/13.
//  Copyright (c) 2016年 wangzijian. All rights reserved.
//

#import "BMaddBBController.h"
#import "RegisterController.h"
@interface BMaddBBController ()

@end

@implementation BMaddBBController{
    
}
- (void)viewDidLoad {
    [super viewDidLoad]; 
    _danxuan1.selected = YES;
    [_danxuan1 setImage:[UIImage imageNamed:@"check_no"] forState:UIControlStateNormal];
    [_danxuan1 setImage:[UIImage imageNamed:@"check_yes"] forState:UIControlStateSelected];
    [_danxuan1 addTarget:self action:@selector(checkboxClick1) forControlEvents:UIControlEventTouchUpInside];
    _danxuan2.selected = NO;
    [_danxuan2 setImage:[UIImage imageNamed:@"check_no"] forState:UIControlStateNormal];
    [_danxuan2 setImage:[UIImage imageNamed:@"check_yes"] forState:UIControlStateSelected];
    
    [_danxuan2 addTarget:self action:@selector(checkboxClick2) forControlEvents:UIControlEventTouchUpInside];
}

- (void)viewWillAppear:(BOOL)animated{
    self.navigationController.navigationBarHidden=NO;
    [ super viewWillAppear:animated];
}
- (IBAction)tapBirthView:(id)sender { 
    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hideDatePickerView)];
    [self.view addGestureRecognizer:tapGesture];
    self.calendarView = [[CalendarView alloc]initWithCurrentDate:[NSDate date]];
    self.calendarView.frame =CGRectMake(0, 0, kScreenWidth, kScreenHeight-164);
    self.calendarView.dateDelegate=self;
    [self.view addSubview:self.calendarView];
    [self.calendarView showDatePickerView];
}
#pragma mark - 返回时间代理
- (void)sendDate:(NSDate *)date{
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"yyyy年MM月dd日"];
    NSString *strDate = [dateFormatter stringFromDate:date];
    NSDateFormatter *dateFormatter2 = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"yyyy-MM-dd"];
        _birthdaylable.text =strDate;
        _birthday=[dateFormatter2 stringFromDate:date];
    
}
-(void)checkboxClick1
{
    if (!_danxuan1.selected) {
        _danxuan1.selected = YES;
        _danxuan2.selected = NO;
        
    }
    
}
-(void)checkboxClick2
{
    if (!_danxuan2.selected) {
        _danxuan1.selected = NO;
        _danxuan2.selected = YES;
    }
    
}
-(void)hideDatePickerView{
    [self.calendarView cancelSelectCurrentDate];
}
-(IBAction)next{
    RegisterController *l = [[RegisterController alloc] init];
    [self.navigationController pushViewController:l animated:YES];
}
@end